///////////////////////////////////////////////////////////////////////////
//
// Spring Engine Source File.
// Copyright (C), Dengtao 2011-2021
// ----------------------------------------------------------------------
// File name:   SfNotification.h
// Version:     v1.0.0
// Created:     2013/06/21 21:17 by dengtao
// Compilers:   Visual Studio 2008
// Description: 
// ----------------------------------------------------------------------
// History:
//
///////////////////////////////////////////////////////////////////////////

#ifndef _SfNotification_H_
#define _SfNotification_H_

#include "SfBaseDefines.h"
#include "SfNotificationExtraInfo.h"
#include <map>

namespace Sunflower
{

//////////////////////////////////////////////////////////////////////////
//Summary:
//	Notification for communication between any objects.
//////////////////////////////////////////////////////////////////////////
class Notification
{
public:
	typedef std::map<std::string, NotificationExtraInfoPtr> ExtraInfoDictionary;
	typedef ExtraInfoDictionary::iterator ExtraInfoDictionaryIterator;
	typedef ExtraInfoDictionary::const_iterator ExtraInfoDictionaryConstIterator;

	enum 
	{
		InvalidNotificationId = 0,
	};

	//
	//Summary:
	//	Check if a given id if invalid id.
	static bool IsValidId(unsigned int id)
	{
		return id != InvalidNotificationId;
	}

public:
	//
	//Summary:
	//	constructor.
	Notification();
	Notification(unsigned int id);
	Notification(const Notification& other);

	//
	//Summary:
	//	operator =
	Notification& operator =(const Notification& other);

	////
	////Summary:
	////	operator ==
	//bool operator ==(const Notification& other);
	//bool operator !=(const Notification& other);

	//
	//Summary:
	//	destructor.
	~Notification();

	//
	//Summary:
	//	id
	unsigned int GetId() const { return m_ID; }
	void SetId(unsigned int id) { m_ID = id; }

	//
	//Summary:
	//	extra-info.
	const ExtraInfoDictionary& GetExtraInfoDic() const { return m_UseInfoDic; }

	//
	//Summary:
	//	retrieves extra-info by given name.
	NotificationExtraInfo* GetExtraInfoNamed(const char* name);

	//
	//Summary:
	//	add extra-info.
	void AddExtraInfo(NotificationExtraInfo* extraInfo);

	//
	//Summary:
	//	remove extra-info.
	void RemoveExtraInfoNamed(const char* name);

private:
	unsigned int m_ID;
	ExtraInfoDictionary m_UseInfoDic;
};

}

#endif
